package com.huang.security.controller;

import com.huang.security.util.JwtUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import sun.text.normalizer.UBiDiProps;

import java.util.HashMap;
import java.util.Map;

@RestController
public class UserController {

    @GetMapping("/login")
    public Map<String,Object> dologin(String username,String password){
      Map<String,Object> map=new HashMap<>();
        if ("jake".equals(username)&&"123".equals(password)) {
          map.put("state", "200");
          map.put("massage", "登录成功");
          Map<String,Object> claims=new HashMap<>();
          claims.put("username", username);
          map.put("Authentication", JwtUtils.generatorToken(claims));

          return map;
        } else {

            map.put("state", "201");
            map.put("massage", "登录失败");
            return map;

        }

    }
}
